package com.laker.admin.module.comm.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.laker.admin.module.comm.entity.CommType;
import com.laker.admin.module.comm.mapper.CommTypeMapper;
import com.laker.admin.module.comm.service.ICommTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.Collection;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author laker
 * @since 2024-03-20
 */
@Service
public class CommTypeServiceImpl extends ServiceImpl<CommTypeMapper, CommType> implements ICommTypeService {

    @Resource
    private CommTypeMapper commTypeMapper;

    @Override
    public <E extends IPage<CommType>> E page(E page, Wrapper<CommType> queryWrapper) {
        return commTypeMapper.selectPage(page, queryWrapper);
    }

    @Override
    public boolean removeById(Serializable id) {
        return SqlHelper.retBool(commTypeMapper.deleteById(id));
    }

    @Override
    public boolean removeByIds(Collection<? extends Serializable> idList) {
        return CollectionUtils.isEmpty(idList) ? false : SqlHelper.retBool(commTypeMapper.deleteBatchIds(idList));
    }
}
